package com.hwua.domain;

import java.io.Serializable;

/**
 * 用户类
 * @author Administrator
 */
public class User implements Serializable,Comparable<User> {
    private int userId;
    private String userName;
    private String userPwd;
    private int userLevel;
    private int isAdmin;

    public User() {
    }

    public User(int userId, String userName, String userPwd, int userLevel, int isAdmin) {
        this.userId = userId;
        this.userName = userName;
        this.userPwd = userPwd;
        this.userLevel = userLevel;
        this.isAdmin = isAdmin;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserPwd() {
        return userPwd;
    }

    public void setUserPwd(String userPwd) {
        this.userPwd = userPwd;
    }

    public int getUserLevel() {
        return userLevel;
    }

    public void setUserLevel(int userLevel) {
        this.userLevel = userLevel;
    }

    public int getIsAdmin() {
        return isAdmin;
    }

    public void setAdmin(int admin) {
        isAdmin = admin;
    }

    /**
     * 根据用户等级排序
     * @param o
     * @return
     */
    @Override
    public int compareTo(User o) {
        return getUserLevel()-o.userLevel;
    }

    @Override
    public String toString() {
        return "User{" +
                "userId=" + userId +
                ", userName='" + userName + '\'' +
                ", userPwd='" + userPwd + '\'' +
                ", userLevel=" + userLevel +
                ", isAdmin=" + isAdmin +
                '}';
    }
}
